package com.yanqu.road.server.timer.beautyescort;

import com.yanqu.road.server.manger.beautyescort.BeautyEscortMgr;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class BeautyEscortTask extends GeneralTask {

    protected Logger logger = LogManager.getLogger(BeautyEscortTask.class.getName());

    private long lastUpdateTime = 0L;


    @Override
    public void doRun() {
        //启动执行一次
        try {
            if (lastUpdateTime < DateHelper.getTodayZeroTimeStamp()) {
                //零点初始在线玩家数据
                BeautyEscortMgr.initOnlineUserWeekData();
                lastUpdateTime = DateHelper.getTodayZeroTimeStamp();
            }
        }catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        try{
            BeautyEscortMgr.uploadUserInfo();
        }catch (Exception e){
            logger.error(e.getMessage(), e);
        }
    }
}
